package com.day1014;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class MainImg {
    public static void main(String[] args) throws Exception{
        ServerSocket serverSocket = new ServerSocket(7777);
        Socket socket = serverSocket.accept();
        InputStream inputStream = socket.getInputStream();
        File file = new File("E:\\喜羊羊与灰太狼高清壁纸\\cc.jpeg");
        FileOutputStream fileOutputStream = new FileOutputStream(file);
        byte[] bytes = new byte[1024];
        int len = -1;
        while ((len = inputStream.read(bytes)) != -1){
            fileOutputStream.write(bytes,0,len);
        }
        fileOutputStream.close();
        inputStream.close();
        socket.close();
    }
}
